package com.ys.web.api.assistant.vo;

import com.ys.utils.base.j2se.StringHandler;
import com.ys.utils.spring.config.SystemError;
import lombok.Data;

/**
 * @ 名称:
 * @ 创建人: dhf
 * @ 参数： null
 * @ 创建时间: 2022/5/10
 * @ 修改人和其它信息
 * @ 返回值: 
 */
@Data
public class GroupAssistantVO {

    public String groupCode;
    public String token;
    public Integer code;
    public String data;
    public double width;
    public double height;

    public void check() {
        if (StringHandler.isEmpty(this.groupCode)) {
            SystemError.wrapBs("202", "未能获取到群标识");
        }
        if (StringHandler.isEmpty(this.token)) {
            SystemError.wrapBs("202", "未能获取到令牌");
        }
        if (StringHandler.isEmpty(this.code)) {
            SystemError.wrapBs("202", "请选择发送消息类型");
        } else {
            if (this.code != 1 && this.code != 2) {
                SystemError.wrapBs("202", "不存在的消息类型");
            }
            if(this.code == 2){
                if (height == 0.0 || width == 0.0) {
                    SystemError.wrapBs("202", "消息内容为图片需传递宽和高");
                }
            }
        }
        if (StringHandler.isEmpty(this.data)) {
            SystemError.wrapBs("202", "消息内容不能为空");
        }
    }

    public String getGroupCode() {
        return groupCode;
    }

    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }
}
